package com.miniportal.base.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.Query;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.miniportal.base.convert.ContactPeopleConvert;
import com.miniportal.base.mapper.IContactPeopleMapper;
import com.miniportal.base.pojo.dto.ContactPeopleDto;
import com.miniportal.base.pojo.entity.ContactPeople;
import com.miniportal.base.service.IContactPeopleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * TODO
 *
 * @author zhouje
 * @since 2022/5/31 0:38
 */
@Service
public class IContactPeopleServiceImpl extends ServiceImpl<IContactPeopleMapper, ContactPeople> implements IContactPeopleService {

    @Autowired
    private IContactPeopleMapper iContactPeopleMapper;

    @Override
    public List<ContactPeopleDto> queryContactPeoples(Long contactId) {
        QueryWrapper query = new QueryWrapper();
        query.eq("contact_id", contactId);
        return ContactPeopleConvert.INSTANCE.dosToDtos(iContactPeopleMapper.selectList(query));
    }
}
